import 'package:flutter/material.dart';
import 'package:ost_flutter_module/common/adapt.dart';

class GIconButton extends StatelessWidget {
  final Widget svg;
  final IconData icon;
  final Color color;
  final double size;
  final VoidCallback onPressed;

  const GIconButton({
    Key key,
    this.icon,
    this.color,
    this.size,
    this.onPressed,
    this.svg,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // return Container(
    //   width: size ?? 30,
    //   child: IconButton(
    //     icon: icon,
    //     color: color,
    //     onPressed: () => onPressed(),
    //   ),
    // );

    return Ink(
      child: Material(
        color: Colors.transparent,
        child: InkWell(
          borderRadius: BorderRadius.circular(Adapt.px(32)),
          onTap: onPressed,
          child: Padding(
            padding: EdgeInsets.all(Adapt.px(8.0)),
            child: svg != null
                ? svg
                : Icon(
                    icon,
                    color: color,
                    size: size,
                  ),
          ),
        ),
      ),
    );
  }
}
